Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add enough types to pass mypy #177

Merged
merged 14 commits into from
Oct 6, 2023
Merged

Add enough types to pass mypy #177

merged 14 commits into from
Oct 6, 2023

Conversation

twizmwazin
Copy link
Member

@twizmwazin twizmwazin commented Aug 28, 2023

This fixes up typing issues enough to pass mypy when run as follows:

mypy --ignore-missing-import archinfo

After this, we may want to consider implementing type stubs for capstone, keystone, and unicorn, as well as type more functions and/or use --check-untyped-defs. By default mypy does not check untyped functions. nor do they pass as of this PR.

Also todo: CI.

sync: angr/pyvex#356

@github-actions
Copy link
Contributor

github-actions bot commented Aug 28, 2023

Test Results

   116 files  +   106     116 suites  +106   1h 25m 13s ⏱️ + 1h 25m 13s
1 388 tests +1 374  1 347 ✔️ +1 333  39 💤 +39  1 +1  1 🔥 +1 
1 394 runs  +1 380  1 353 ✔️ +1 339  39 💤 +39  1 +1  1 🔥 +1 

For more details on these failures and errors, see this check.

Results for commit 81c7628. ± Comparison against base commit 4c78edd.

♻️ This comment has been updated with latest results.

@twizmwazin
Copy link
Member Author

As far as I can tell, the largest flaw in how I've done this so far is that I tried to make Endness an actual type. I may revert that and just type it as str everywhere and make an issue about refactoring it into something real in the future.

@rhelmot
Copy link
Member

rhelmot commented Aug 29, 2023

I don't think your current endness enum will actually work without 3.11's StrEnum - we have wayyyyyyyy too much legacy code that does direct comparisons with Iend_LE and friends

@twizmwazin
Copy link
Member Author

Yep. I saw StrEnum in the docs and figured that might be a good fit, but it's 3.11 and I don't see us bumping the min version for that. Doing it the way I did here would require a medium size refactor, mostly in angr proper (got cle and pyvex tests passing locally). We could consider backporting it on python<3.11.

@twizmwazin twizmwazin force-pushed the pass-mypy branch 2 times, most recently from 81c7628 to 48f6f0c Compare September 12, 2023 17:49
@twizmwazin twizmwazin requested a review from rhelmot September 12, 2023 18:40
@twizmwazin twizmwazin merged commit 1ac4ea8 into master Oct 6, 2023
15 of 16 checks passed
@twizmwazin twizmwazin deleted the pass-mypy branch October 6, 2023 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants